@extends('Admin.base')
@section('css')
    <link rel="stylesheet" href="/Admin/layuiadmin/style/template.css" media="all">
    <link rel="stylesheet" href="/Admin/layuiadmin/css/extend/formSelects-v4.css" media="all">
@endsection
@section('style')
    <style>
        .cmdlist-container{margin-bottom: 20px;}

        .cmdlist-bottom{
            background-color: rgba(0, 0, 0, .6);
            filter: progid:DXImageTransform.Microsoft.Gradient(startColorStr=#40000000,endColorStr=#40000000);
            color:#fff;
            width: 100%;
            height:0;
            position: absolute;
            bottom: 0px;
            left: 0px;
            vertical-align:middle;
            text-align: center;
            overflow: hidden;
        }
        .cmdlist-container .banner-show:hover .cmdlist-bottom{
            height: 10px;
        }

        .cmdlist-mid{
            display:inline;
            line-height:60px
        }
    </style>
@endsection
@section('content')
    <div class="layui-card">
        <div class="layui-card-header layuiadmin-card-header-auto">
            <fieldset class="layui-elem-field layui-field-title">
                <legend>新建新人优惠券礼包活动</legend>
            </fieldset>
        </div>
        <div class="layui-card-body">
            <div class="layui-form-item ">
                <div class="layui-inline">
                    <label class="layui-form-label">开 始 日 期</label>
                    <div class="layui-input-inline">
                        <input type="text" name="start_at" lay-verify="required" {{ isset( $data) ? 'disabled' :''}} value="{{ $data->start_at ?? ''}}" class="layui-input" id="test17" placeholder="yyyy-MM-dd">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">截 止 日 期</label>
                    <div class="layui-input-inline">
                        <input type="text" name="end_at" lay-verify="required" {{ isset( $data) ? 'disabled' :''}}  value="{{ $data->end_at ?? ''}}" class="layui-input" id="test18" placeholder="yyyy-MM-dd">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">启动广告图</label>
                <div class="layui-col-md4 layui-col-sm4">

                    <div class="cmdlist-container">
                        <div class="banner-show" style="position: relative;">
                            <div style="overflow: hidden;">

                                <img src="{{$data->photo ?? 'http://ccvs-oss.oss-cn-hangzhou.aliyuncs.com/goods/d7NzLMLVweSouv7VZ0mByYjI2fTShEWrjFQUugnC.png'}}" >

                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-card-header layuiadmin-card-header-auto">
                <fieldset class="layui-elem-field layui-field-title">
                    <legend>新人优惠券配置</legend>
                </fieldset>
            </div>
            <div class="layui-card-body" style="width:700px;">
                <table id="LAY-table" lay-filter="LAY-table"></table>
            </div>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    {{isset($data) ? method_field('PUT') : ''}}
                    {{csrf_field()}}
                    <a  class="layui-btn layui-btn-danger" href="{{route('issue.index')}}" >关 闭</a>
                </div>
            </div>
        </div>
    </div>
@endsection
@section('script')
    <script src="/js/ajax.js"></script>
    <script>
        layui.use(['laydate', 'form', 'upload', 'table' ], function () {
            var table = layui.table;

            table.render({
                elem: '#LAY-table'
                ,toolbar: '#toolbarDemo'
                ,defaultToolbar: []
                ,url: "{{url('/admin/issue/activity_table')}}?id={{$data['id']}}"
                ,method: "post"
                ,page: false //开启分页
                ,limit:10
                ,cols: [[
                    {field:'activity_name', title:'优惠券名称' }
                    ,{field:'type', title:'规则',templet:function (d) {
                        if(d.rule_type == 2){
                            return  "满" + d.full + "减" + d.less;
                        }else {
                            return   "立减" + d.less;
                        }
                    }}
                    ,{field: 'activity_tim', title: '有效期',templet:function(d){
                        return d.activity_time == 0 ? '永久生效': '领券后'+ d.activity_time + '天'  ;
                    }}
                    ,{field: 'amount', title: '发放数量（张）' ,templet:function(d){
                        return d.amount   ? d.amount  : 0;
                    }}
                    ,{field: 'amount_use', title: '已使用（张）' ,templet:function(d){
                        return d.amount_use   ? d.amount_use  : 0;
                    }}
                ]]

            });

        });

    </script>


@endsection
